package day09API.stringBuilder;

public class Test02 {
    public static void main(String[] args) {
        String path = "http://localhost:8088/myweb/reg?name=zhangsan";
        String[] data ;
        data = path.split("\\?");
        System.out.println(data[0]);
        System.out.println(data[1]);
        path = "http://localhost:8088/myweb/reg?name=zhangsan&pwd=123456&nick=san&age=16";
        data = path.split("\\?");
        System.out.println(data[0]);
        String[] data1 = data[1].split("&");
        for (int i = 0; i < data1.length; i++) {
           String[] data2 = data1[i].split("=");
            System.out.print("参数名：" + data2[0]+"\t");
            System.out.println("参数：" + data2[1]);
        }
       /* String[] data2 = data[1].split("[&=]");
        for (int i = 0; i < data2.length; i+=2) {
            System.out.print("参数名：" + data2[i]+"\t");
            System.out.println("参数：" + data2[i+1]);
        }*/

    }
}
